<template>
  <Table class="default" filter v-bind="tableOpts" v-on="tableEvent">
    <template #operator>
      <div class="operator-wrap">
         <modifyWarehouse ref="dialogRef" @change="fetchCurrentTable" />
      </div>
    </template>
  </Table>
</template>

<script>
import dayjs from "dayjs";
import modifyWarehouse from "./components/modifyWarehouse.vue";
import tableMixins from "@/mixins/tableMixins.vue";
export default {
  name: "WarehouseList",
  mixins: [tableMixins],
  components: { modifyWarehouse },
  data() {
    return {
      apiName: "warehouseWarehouseList",
      form: {
        warehouseName: {
          tag: "el-input",
          label: "仓库名称:",
          value: "",
          props: {
            clearable: true,
            placeholder: "请输入仓库名称",
          },
        },
      },
    };
  },
  methods: {
    handleAction(opts, row) {
      const { warehouseName: name, warehouseId } = row;
      if (["edit"].includes(opts)) this.showDialog(opts, row);
      else if (opts === "delete")
        this.showConfirm(`确认删除【${name}】？`, "warehouseWarehouseDelete", {
          warehouseId,
        });
      else {
        const ref = this.$refs[opts];
        ref && ref.showDialog(opts, row);
      }
    },
  },
};
</script>

<style lang="less" scoped>
@import "../../assets/css/public.css";
</style>
